function initUploadMediaFile(id,type){
    var container = $('body');
    if (id){
        container = $(id);
    }
    var uploadFiles = container.find('input[data-target="uploadMediaFile"]');
    $.each(uploadFiles,function(i,v){
        $_self = $(v);
        var initialPreview = [];
        var initialPreviewConfig = [];
        var previewImage = $('input[name="'+$_self.attr('data-for')+'"]').attr('data-preview')||$('input[name="'+$_self.attr('data-for')+'"]').val();
        if(previewImage){
            initialPreview.push(previewImage);
            initialPreviewConfig.push({key:getFileName(previewImage)})
        }
        $_self.fileinput({
            //allowedFileTypes:['image'],
            language:'zh',
            // initialPreview:initialPreview,
            // initialPreviewConfig:initialPreviewConfig,
            showPreview:false,
            deleteUrl:'',
            // initialPreviewAsData: true,
            multiple:false,
            allowedFileExtensions:"['"+type+"']",
            uploadUrl: "/tmp/upload",
            overwriteInitial:true,
            dropZoneEnabled:false
        }).on('fileuploaded', function(event, data, previewId, index) {
            if (data.response.code == 0){
                alert(data);
                // if (typeof window.uploadFilesSuccess !== 'undefined'){
                //     window.uploadFilesSuccess(data.response.result,$(event.target).attr('data-for'));
                // }
                // $('#'+previewId).attr('data-code',getFileName(data.response.result.attachment));
                // $('input[name="'+$(event.target).attr('data-for')+'"]').val(data.response.result.original);
            }else {
                utils.showNotification('上传文件失败',3);
            }

        }).on('filecleared',function(event){
            console.log(event,1);
            $('input[name="'+$(event.target).attr('data-for')+'"]').val('');
        }).on('filedeleted',function(event,key){
            //console.log(event,key,2);
            $('input[name="'+$(event.target).attr('data-for')+'"]').val('');
        }).on('filereset',function(event){
            // console.log(event,3);
            $('input[name="'+$(event.target).attr('data-for')+'"]').val('');
        }).on('filesuccessremove',function(event,id){
            $('input[name="'+$(event.target).attr('data-for')+'"]').val('');
        });
    })
}
